package com.example.callcenter.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.example.callcenter.entity.CallRecord;
import com.example.callcenter.dto.PageQueryDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface CallRecordMapper extends BaseMapper<CallRecord> {
    /**
     * 按任务ID分页查询
     */
    IPage<CallRecord> selectByTaskId(IPage<CallRecord> page, @Param("taskId") Long taskId);

    /**
     * 按销售ID分页查询
     */
    IPage<CallRecord> selectBySalesId(IPage<CallRecord> page, @Param("salesId") Long salesId);

    /**
     * 销售业绩统计
     */
    IPage<Map<String, Object>> selectSalesStatistics(
            IPage<Map<String, Object>> page,
            @Param("queryDTO") PageQueryDTO queryDTO);

    /**
     * 任务通话详情统计
     */
    List<Map<String, Object>> selectTaskDetailStats(@Param("taskId") Long taskId);

    /**
     * 按结果类型统计
     */
    List<Map<String, Object>> selectByResultType(@Param("taskId") Long taskId);
}